import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContactFormVO, ContactFormForm, ContactFormQuery } from '@/api/business/contactForm/types';

/**
 * 查询联系消息列表
 * @param query
 * @returns {*}
 */

export const listContactForm = (query?: ContactFormQuery): AxiosPromise<ContactFormVO[]> => {
  return request({
    url: '/business/contactForm/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询联系消息详细
 * @param id
 */
export const getContactForm = (id: string | number): AxiosPromise<ContactFormVO> => {
  return request({
    url: '/business/contactForm/' + id,
    method: 'get'
  });
};

/**
 * 新增联系消息
 * @param data
 */
export const addContactForm = (data: ContactFormForm) => {
  return request({
    url: '/business/contactForm',
    method: 'post',
    data: data
  });
};

/**
 * 修改联系消息
 * @param data
 */
export const updateContactForm = (data: ContactFormForm) => {
  return request({
    url: '/business/contactForm',
    method: 'put',
    data: data
  });
};

/**
 * 删除联系消息
 * @param id
 */
export const delContactForm = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/contactForm/' + id,
    method: 'delete'
  });
};
